// 封装本地存储相关

class LoctionCatch {
  setLocation(key: string, value: any) {
    window.localStorage.setItem(key, JSON.stringify(value))
  }

  getLocation(key: string) {
    const data = window.localStorage.getItem(key)
    if (data) {
      return JSON.parse(data)
    }
  }

  deleteLocation(name: string) {
    window.localStorage.removeItem(name)
  }

  clearLocaation() {
    window.localStorage.clear()
  }
}

export default new LoctionCatch()
